#include <cstdio>
#include <cctype>

#define MAX_ROW 140


int main ()
{
	int n;
	char *cs, *cd, s[MAX_ROW], d[MAX_ROW];

	while (fgets(s, MAX_ROW, stdin))
	{
		n = 0;
		cd = d;
		for (cs = s; *cs != '\n'; ++cs)
		{
			if (isdigit(*cs))
			{
				n += *cs - '0';
				continue;
			}
			if (*cs == '!')
			{
				*cd = '\n';
				++cd;
				continue;
			}

			if (*cs == 'b')
			{
				*cs = ' ';
			}
			while (--n >= 0)
			{
				*cd = *cs;
				++cd;
			}
			n = 0;
		}
		*cd = '\0';
		puts(d);
	}

	return 0;
}